//
//  LMSettingTableViewController.m
//  彩票
//
//  Created by apple on 15/9/23.
//  Copyright (c) 2015年 李明. All rights reserved.
//

#import "LMSettingTableViewController.h"
#import "LMSettingObject.h"
#import "LMSettingTableViewCell.h"
#import "ViewController.h"
#import "MBProgressHUD+Extend.h"
#import "LMPushAndWaringViewController.h"
#import "LMSettingObjectGroup.h"
#import "LMHelpViewController.h"
#import "UIAboutViewController.h"
#import "LMTelViewController.h"
@implementation LMSettingTableViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    LMSettingObject *item1 = [LMSettingObject SettingObjectWithIcon:@"MorePush" title:@"推送和提醒" type:@"1" vcClass:[LMPushAndWaringViewController class]];
    LMSettingObject *item2 = [LMSettingObject SettingObjectWithIcon:@"handShake" title:@"摇一摇机选" type:@"0"];
    LMSettingObject *item3 = [LMSettingObject SettingObjectWithIcon:@"MoreShare" title:@"声音和效果" type:@"0"];
    
    LMSettingObjectGroup *group1 = [[LMSettingObjectGroup alloc] init];
    group1.items =  @[item1,item2,item3];
    
    LMSettingObject *item4 = [LMSettingObject SettingObjectWithIcon:@"MoreUpdate" title:@"检查版本更新" type:@"1"];
    item4.operationBlock=^{
        NSLog(@"更新版本");
        NSDictionary *info = [[NSBundle mainBundle] infoDictionary];
                              
        NSString *localVersion = info[@"CFBundleShortVersionString"];
        
        [MBProgressHUD showMessage:@"正在检查更新版本...."];
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2*NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
          
          [MBProgressHUD hideHUD];
          [MBProgressHUD showSuccess:@"已经是最新的版本"];
        });
        
    };
    LMSettingObject *item5 = [LMSettingObject SettingObjectWithIcon:@"MoreHelp" title:@"帮助" type:@"1" vcClass:[LMHelpViewController class]];
    LMSettingObject *item6 = [LMSettingObject SettingObjectWithIcon:@"MoreShare" title:@"分享" type:@"1" vcClass:[UIAboutViewController class]];
    LMSettingObject *item7 = [LMSettingObject SettingObjectWithIcon:@"MoreMessage" title:@"查看消息" type:@"1"];
    LMSettingObject *item8 = [LMSettingObject SettingObjectWithIcon:@"MoreNetease" title:@"产品推荐" type:@"1"];
    LMSettingObject *item9 = [LMSettingObject SettingObjectWithIcon:@"MoreAbout" title:@"关于" type:@"1" vcClass:[LMTelViewController class]];
    
    LMSettingObjectGroup *group2 = [[LMSettingObjectGroup alloc] init];
    group2.items =  @[item4,item5,item6,item7,item8,item9];
    
    [self.settingitemArray addObject:group1];
    
    [self.settingitemArray addObject:group2];
}





@end
